import tkinter as tk

root = tk.Tk()
root.title("Demo")
root.geometry("800x600")
app_frame = tk.Frame(root)
app_frame.pack(fill="both", expand=True)

# 标签
lvar = tk.StringVar()
lvar.set("hello world")
label = tk.Label(app_frame, textvariable=lvar, bg="green", font=("Arial", 12), width=15, height=2)
label.pack()

def print_selection(v):
    lvar.set(v)

# 拖动条
var = tk.DoubleVar()
scale = tk.Scale(app_frame, variable=var, from_=0, to=100, orient=tk.HORIZONTAL, length=200, showvalue=0, tickinterval=20, resolution=0.01,command=print_selection)
scale.pack()

root.mainloop()
